package com.definesys.smecrailtransit.module.Splash;

import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.animation.AlphaAnimation;

import com.definesys.smecrailtransit.R;
import com.definesys.smecrailtransit.base.SmecBaseActivity;
import com.definesys.smecrailtransit.module.Login.LoginPresenter;

/**
 * Created by xupeizuo on 2017/7/26.
 */

public class SplashActivity extends SmecBaseActivity<LoginPresenter> implements SplashContract{

    private String[] permissionRequests=new String[]{

    };

    private Handler mHandler=new Handler();

    @Override
    public LoginPresenter getPresenter() {
        return new LoginPresenter(this);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        final View view=View.inflate(this,R.layout.activity_splash,null);
        setContentView(view);
        AlphaAnimation alphaAnimation=new AlphaAnimation(0.3f,1.0f);
        alphaAnimation.setDuration(2000);
        view.startAnimation(alphaAnimation);

        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                autoLogin();
            }
        },1000);
    }

    @Override
    public void autoLogin() {
        mPresenter.autoLogin();
    }
}
